<template>
  <div>
    <el-select v-model="value" placeholder="请选择" @change="selectChange">
      <el-option
        v-for="(item,index) in options"
        :key="index"
        :label="item.label"
        :value="item.value"
      />
    </el-select>
  </div>
</template>

<script>
export default {
  props: {
    options: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data() {
    return {
      value: ''
    }
  },
  watch: {
    options() {
      this.value = this.options[0].value
    }
  },
  mounted() {
    // console.log(this.options[0].label)
    this.options[0].label === '' ? '' : this.value = this.options[0].value
    // this.value = this.options[0].value
  },
  methods: {
    selectChange(val) {
      this.$emit('classfySelect', val)
      console.log(val)
    }
  }
}
</script>
